<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="Cask Data, Inc." name="author" />
<meta content="HTTP RESTful Interface to the Cask Data Application Platform" name="description" />
<meta content="Copyright © 2014-2017 Cask Data, Inc." name="copyright" />


    <meta name="git_release" content="6.1.1">
    <meta name="git_hash" content="05fbac36f9f7aadeb44f5728cea35136dbc243e5">
    <meta name="git_timestamp" content="2020-02-09 08:22:47 +0800">
    <title>Monitor HTTP RESTful API</title>

    <link rel="stylesheet" href="../_static/cdap-bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-3.3.6/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/cdap-dynamicscrollspy-4.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/jquery.mCustomScrollbar.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/cdap-jquery.mCustomScrollbar.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/abixTreeList-2.css" type="text/css" />
    <link rel="stylesheet" href="../_static/cdap-bootstrap.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '6.1.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="top" title="Cask Data Application Platform 6.1.1 Documentation" href="../index.html" />
    <link rel="up" title="CDAP HTTP RESTful API v3" href="index.html" />
    <link rel="next" title="Namespace HTTP RESTful API" href="namespace.html" />
    <link rel="prev" title="Metrics HTTP RESTful API" href="metrics.html" />
    <!-- block extrahead -->
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <!-- block extrahead end -->

</head>
<body role="document">

<!-- block navbar -->
<div id="navbar" class="navbar navbar-inverse navbar-default navbar-fixed-top">
    <div class="container-fluid">
      <div class="row">
        <div class="navbar-header">
          <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
          <a class="navbar-brand" href="../table-of-contents/../../index.html">
            <span><img alt="CDAP logo" src="../_static/cdap_logo.svg"/></span>
          </a>

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>

          <div class="pull-right">
            <div class="dropdown version-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                role="button" aria-haspopup="true" aria-expanded="false">
                v 6.1.1 <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <li><a href="//docs.cdap.io/cdap/5.1.2/en/index.html">v 5.1.2</a></li>
                <li><a href="//docs.cdap.io/cdap/4.3.4/en/index.html">v 4.3.4</a></li>
              </ul>
            </div>
          </div>
          <form class="navbar-form navbar-right navbar-search" action="../search.html" method="get">
            <div class="form-group">
              <div class="navbar-search-image material-icons"></div>
              <input type="text" name="q" class="form-control" placeholder="  Search" />
            </div>
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>

          <div class="collapse navbar-collapse nav-collapse navbar-right navbar-navigation">
            <ul class="nav navbar-nav"><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../index.html">简介</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../guides.html">手册</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link current" href="../table-of-contents/../../reference-manual/index.html">参考</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../faqs/index.html">帮助</a></li>
            </ul>
          </div>

        </div>
      </div>
    </div>
  </div><!-- block navbar end -->
<!-- block main content -->
<div class="main-container container">
  <div class="row"><div class="col-md-2">
      <div id="sidebar" class="bs-sidenav scrollable-y-outside" role="complementary">
<!-- theme_manual: reference-manual -->
<!-- theme_manual_highlight: reference -->
<!-- sidebar_title_link: Reference -->

  <div role="note" aria-label="manuals links"><h3>Reference</h3>
    <ul class="reference-page-menu">
      <nav class="pagenav">
      <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html"> Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../characters.html"> Supported Characters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli-api.html"> Command Line Interface API</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html"> HTTP RESTful API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="artifact.html">Artifact</a></li>
<li class="toctree-l2"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="dataset.html">Dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="lifecycle.html">Lifecycle</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html">Logging</a></li>
<li class="toctree-l2"><a class="reference internal" href="metadata.html">Metadata</a></li>
<li class="toctree-l2"><a class="reference internal" href="metrics.html">Metrics</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Monitor</a></li>
<li class="toctree-l2"><a class="reference internal" href="namespace.html">Namespace</a></li>
<li class="toctree-l2"><a class="reference internal" href="dashboard.html">Dashboard</a></li>
<li class="toctree-l2"><a class="reference internal" href="preferences.html">Preferences</a></li>
<li class="toctree-l2"><a class="reference internal" href="profile.html">Profile</a></li>
<li class="toctree-l2"><a class="reference internal" href="query.html">Query</a></li>
<li class="toctree-l2"><a class="reference internal" href="reports.html">Reports</a></li>
<li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html">Service</a></li>
<li class="toctree-l2"><a class="reference internal" href="transactions.html">Transactions</a></li>
<li class="toctree-l2"><a class="reference internal" href="workflow.html">Workflow</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../java-client-api.html"> Java Client API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../javadocs/index.html"> Javadocs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release-notes.html"> 发行说明</a></li>
<li class="toctree-l1"><a class="reference internal" href="../licenses/index.html"> Trademarks, Licenses, and Dependencies</a></li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html"> 术语表</a></li>
<li class="toctree-l1"><a class="reference internal" href="../genindex.html"> Index</a></li>
</ul>
</nav>
    </ul>
  </div></div>
    </div><div class="col-md-8 content" id="main-content">
    
  <div class="section" id="monitor-http-restful-api">
<span id="http-restful-api-monitor"></span><h1>Monitor HTTP RESTful API<a class="headerlink" href="#monitor-http-restful-api" title="Permalink to this headline">🔗</a></h1>
<p>Use the CDAP Monitor HTTP RESTful API to examine the CDAP system services used internally by CDAP.
Additional details on monitoring can be found in the <a class="reference external" href="../../../admin-manual/operations/logging.html#logging-monitoring" title="(in Cask Data Application Platform v6.1.1)"><span class="xref std std-ref">管理手册: Logging
and Monitoring</span></a>.</p>
<p>All methods or endpoints described in this API have a base URL (typically
<code class="docutils literal notranslate"><span class="pre">http://&lt;host&gt;:11015</span></code> or <code class="docutils literal notranslate"><span class="pre">https://&lt;host&gt;:10443</span></code>) that precedes the resource
identifier, as described in the <a class="reference internal" href="introduction.html#http-restful-api-conventions-base-url"><span class="std std-ref">RESTful API Conventions</span></a>.
These methods return a status code, as listed in the <a class="reference internal" href="introduction.html#http-restful-api-status-codes"><span class="std std-ref">RESTful API  Status Codes</span></a>.</p>
<div class="section" id="listing-all-system-services-and-their-details">
<h2>Listing all System Services and their Details<a class="headerlink" href="#listing-all-system-services-and-their-details" title="Permalink to this headline">🔗</a></h2>
<p>For the detailed information of all available CDAP system services, use:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services</span>
</pre></div>
</div>
<p>The response body will contain a JSON-formatted list of the existing system services:</p>
<div class="highlight-json-ellipsis notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">{</span>
        <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;appfabric&quot;</span><span class="p">,</span>
        <span class="nt">&quot;description&quot;</span><span class="p">:</span> <span class="s2">&quot;Service for managing application lifecycle.&quot;</span><span class="p">,</span>
        <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;OK&quot;</span><span class="p">,</span>
        <span class="nt">&quot;logs&quot;</span><span class="p">:</span> <span class="s2">&quot;OK&quot;</span><span class="p">,</span>
        <span class="nt">&quot;min&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nt">&quot;max&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nt">&quot;requested&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nt">&quot;provisioned&quot;</span><span class="p">:</span> <span class="mi">1</span>
    <span class="p">}</span>
    <span class="c">...</span>
<span class="p">]</span>
</pre></div>
</div>
<p>See <a class="reference internal" href="logging.html#http-restful-api-logging-downloading-system-logs"><span class="std std-ref">downloading System Logs</span></a> for
information and an example of using these system services.</p>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">200</span> <span class="pre">OK</span></code></td>
<td>The event successfully called the method, and the body contains the results</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="checking-the-status-of-all-system-services">
<h2>Checking the Status of all System Services<a class="headerlink" href="#checking-the-status-of-all-system-services" title="Permalink to this headline">🔗</a></h2>
<p>To check the status of all the CDAP system services, use:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/status</span>
</pre></div>
</div>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">200</span> <span class="pre">OK</span></code></td>
<td>The event successfully called the method, and the body contains the results</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="checking-the-status-of-a-system-service">
<h2>Checking the Status of a System Service<a class="headerlink" href="#checking-the-status-of-a-system-service" title="Permalink to this headline">🔗</a></h2>
<p>To check the status of a specific CDAP system service, use:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/&lt;service-id&gt;/status</span>
</pre></div>
</div>
<p>The status of these CDAP system services can be checked:</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="25%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Service</th>
<th class="head">Service ID</th>
<th class="head">Description of the service</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">Metrics</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">metrics</span></code></td>
<td>Service that handles metrics related HTTP requests</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">Transaction</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">transaction</span></code></td>
<td>Service that handles transactions</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">Streams</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">streams</span></code></td>
<td>Service that handles stream management</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">App</span> <span class="pre">Fabric</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">appfabric</span></code></td>
<td>Service that handles application fabric requests</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">Log</span> <span class="pre">Saver</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">log.saver</span></code></td>
<td>Service that aggregates all system and application logs</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">Metrics</span> <span class="pre">Processor</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">metrics.processor</span></code></td>
<td>Service that aggregates all system and application metrics</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">Dataset</span> <span class="pre">Executor</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">dataset.executor</span></code></td>
<td>Service that handles all data-related HTTP requests</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">Explore</span> <span class="pre">Service</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">explore.service</span></code></td>
<td>Service that handles all HTTP requests for ad-hoc data exploration</td>
</tr>
</tbody>
</table>
<p><strong>Note:</strong> The service status checks are more useful when CDAP is running in a distributed cluster mode.</p>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">200</span> <span class="pre">OK</span></code></td>
<td>The service is up and running</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">404</span> <span class="pre">Not</span> <span class="pre">Found</span></code></td>
<td>The service is either not running or not found</td>
</tr>
</tbody>
</table>
<p class="rubric">Example</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><th class="stub">HTTP Method</th>
<td><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/v3/system/services/metrics/status</span></code></td>
</tr>
<tr class="row-even"><th class="stub">Description</th>
<td>Returns the status of the metrics service</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="checking-the-status-of-a-system-upgrade">
<span id="http-restful-api-monitor-status-system-upgrade"></span><h2>Checking the Status of a System Upgrade<a class="headerlink" href="#checking-the-status-of-a-system-upgrade" title="Permalink to this headline">🔗</a></h2>
<p>To check the status of a <a class="reference external" href="../../../admin-manual/upgrading/index.html#upgrading-index" title="(in Cask Data Application Platform v6.1.1)"><span class="xref std std-ref">CDAP system upgrade</span></a>, use:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/upgrade/status</span>
</pre></div>
</div>
<p><strong>Note:</strong> This returns useful information only for Distributed CDAP installation upgrades.</p>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">200</span> <span class="pre">OK</span></code></td>
<td>The event successfully called the method, and the body contains the results</td>
</tr>
</tbody>
</table>
<p class="rubric">Example</p>
<p>The response body will contain a JSON-formatted list of upgraded components:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">{</span>
<span class="go">    &quot;metadata&quot;:true,</span>
<span class="go">}</span>
</pre></div>
</div>
</div>
<div class="section" id="container-information-of-a-system-service">
<h2>Container Information of a System Service<a class="headerlink" href="#container-information-of-a-system-service" title="Permalink to this headline">🔗</a></h2>
<p>If you are trying to debug a CDAP system service, you can retrieve container info for a
system service with:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/&lt;service-id&gt;/live-info</span>
</pre></div>
</div>
<p>where</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">service-id</span></code></td>
<td>Name (ID) of the system service</td>
</tr>
</tbody>
</table>
<p><strong>Note:</strong> This returns useful information only for Distributed CDAP installations.</p>
<p class="rubric">Example</p>
<p>For example, to retrieve the list of CDAP Master services, issue an HTTP GET request to
the URL:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/appfabric/live-info</span>
</pre></div>
</div>
<p>The response body will contain a JSON-formatted list of CDAP Master services, with the
first container listed being the active CDAP Master in an HA deployment:</p>
<div class="highlight-json-ellipsis notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="nt">&quot;containers&quot;</span><span class="p">:[</span>
                    <span class="p">{</span>
                        <span class="nt">&quot;host&quot;</span><span class="p">:</span><span class="s2">&quot;host1.example.com&quot;</span><span class="p">,</span>
                        <span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="s2">&quot;appfabric&quot;</span><span class="p">,</span>
                        <span class="nt">&quot;type&quot;</span><span class="p">:</span><span class="s2">&quot;system_service&quot;</span>
                    <span class="p">},</span>
                    <span class="p">{</span>
                        <span class="nt">&quot;host&quot;</span><span class="p">:</span><span class="s2">&quot;host2.example.com&quot;</span><span class="p">,</span>
                        <span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="s2">&quot;appfabric&quot;</span><span class="p">,</span>
                        <span class="nt">&quot;type&quot;</span><span class="p">:</span><span class="s2">&quot;system_service&quot;</span>
                    <span class="p">}</span>
                 <span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="restarting-system-service-instances">
<h2>Restarting System Service Instances<a class="headerlink" href="#restarting-system-service-instances" title="Permalink to this headline">🔗</a></h2>
<p>To restart all instances of a CDAP system service, you can issue an HTTP POST request to the URL:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">POST /v3/system/services/&lt;service-id&gt;/restart</span>
</pre></div>
</div>
<p>You can restart a particular instance of a system service in CDAP, using its instance id, by issuing
an HTTP POST request to the URL:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">POST /v3/system/services/&lt;service-id&gt;/instances/&lt;instance-id&gt;/restart</span>
</pre></div>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">service-id</span></code></td>
<td>Name (ID) of the system service whose instances are to be restarted</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">instance-id</span></code></td>
<td>Specific instance of a service that needs to be restarted;
<code class="docutils literal notranslate"><span class="pre">instance-id</span></code> runs from 0 to (the number of instances-per-service -1)</td>
</tr>
</tbody>
</table>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">403</span> <span class="pre">Bad</span> <span class="pre">Request</span></code></td>
<td>The service is unavailable because it was not enabled</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">404</span> <span class="pre">Service</span> <span class="pre">not</span> <span class="pre">found</span></code></td>
<td>The service name is not valid</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">500</span> <span class="pre">Internal</span> <span class="pre">error</span></code></td>
<td>Internal error encountered when processing the request</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">503</span> <span class="pre">Service</span> <span class="pre">Unavailable</span></code></td>
<td>The service is unavailable. For example, it may not yet have been started</td>
</tr>
</tbody>
</table>
<p>To retrieve details of the last restart attempt made for a particular service, issue an HTTP GET request to the URL:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/&lt;service-id&gt;/latest-restart</span>
</pre></div>
</div>
<p>The response body will contain a JSON-formatted status of the last restart attempt for that service:</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="nt">&quot;instanceIds&quot;</span><span class="p">:</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span>
    <span class="nt">&quot;serviceName&quot;</span><span class="p">:</span> <span class="s2">&quot;dataset.executor&quot;</span><span class="p">,</span>
    <span class="nt">&quot;startTimeInMs&quot;</span><span class="p">:</span> <span class="mi">1437070039984</span><span class="p">,</span>
    <span class="nt">&quot;endTimeInMs&quot;</span><span class="p">:</span> <span class="mi">1437070039992</span><span class="p">,</span>
    <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;SUCCESS&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">service-id</span></code></td>
<td>Name (ID) of the system service for which details of last restart are to be retrieved</td>
</tr>
</tbody>
</table>
<p class="rubric">HTTP Responses</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Status Codes</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">404</span> <span class="pre">Service</span> <span class="pre">not</span> <span class="pre">found</span></code></td>
<td>The service name is not valid</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">500</span> <span class="pre">Internal</span> <span class="pre">error</span></code></td>
<td>Internal error encountered when processing the request</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="scaling-system-services">
<span id="http-restful-api-monitor-scaling-system-services"></span><h2>Scaling System Services<a class="headerlink" href="#scaling-system-services" title="Permalink to this headline">🔗</a></h2>
<p>In distributed CDAP installations, the number of instances for CDAP system services
can be queried and changed by using these commands:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">GET /v3/system/services/&lt;service-id&gt;/instances</span>
<span class="go">PUT /v3/system/services/&lt;service-id&gt;/instances</span>
</pre></div>
</div>
<p>with the arguments as a JSON string in the body:</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span>{ &quot;instances&quot; : &lt;quantity&gt; }
</pre></div>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">service-id</span></code></td>
<td>Name (ID) of the system service</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">quantity</span></code></td>
<td>Number of instances to be used</td>
</tr>
</tbody>
</table>
<p><strong>Note:</strong> In the CDAP Sandbox, trying to set the instances of system services will return a Status Code <code class="docutils literal notranslate"><span class="pre">400</span> <span class="pre">Bad</span> <span class="pre">Request</span></code>.</p>
<p class="rubric">Examples</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><th class="stub">HTTP Method</th>
<td><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/v3/system/services/metrics/instances</span></code></td>
</tr>
<tr class="row-even"><th class="stub">Description</th>
<td>Determine the number of instances being used for the metrics HTTP service</td>
</tr>
<tr class="row-odd"><th class="stub">&#160;</th>
<td>&#160;</td>
</tr>
<tr class="row-even"><th class="stub">HTTP Method</th>
<td><p class="first"><code class="docutils literal notranslate"><span class="pre">PUT</span> <span class="pre">/v3/system/services/metrics/instances</span></code>
<code class="docutils literal notranslate"><span class="pre">instances</span></code></p>
<p>with the arguments as a JSON string in the body:</p>
<div class="last highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nt">&quot;instances&quot;</span> <span class="p">:</span> <span class="mi">2</span> <span class="p">}</span>
</pre></div>
</div>
</td>
</tr>
<tr class="row-odd"><th class="stub">Description</th>
<td>Sets the number of instances of the metrics HTTP service to 2</td>
</tr>
</tbody>
</table>
</div>
</div>

</div>
    <div class="col-md-2">
      <div id="right-sidebar" class="bs-sidenav scrollable-y" role="complementary">
        <div id="localtoc-scrollspy">
        </div>
      </div>
    </div></div>
</div>
<!-- block main content end -->
<!-- block footer -->
<footer class="footer">
      <div class="container">
        <div class="row">
          <div class="col-md-2 footer-left"><a title="Metrics HTTP RESTful API" href="metrics.html" />Previous</a></div>
          <div class="col-md-8 footer-center"><a class="footer-tab-link" href="../table-of-contents/../../reference-manual/licenses/index.html">Copyright</a> &copy; 2014-2020 Cask Data, Inc.&bull; <a class="footer-tab-link" href="//docs.cask.co/cdap/6.1.1/cdap-docs-6.1.1-web.zip" rel="nofollow">Download</a> an archive or
<a class="footer-tab-link" href="//docs.cask.co/cdap">switch the version</a> of the documentation
          </div>
          <div class="col-md-2 footer-right"><a title="Namespace HTTP RESTful API" href="namespace.html" />Next</a></div>
        </div>
      </div>
    </footer>
<!-- block footer end -->
<script type="text/javascript" src="../_static/bootstrap-3.3.6/js/bootstrap.min.js"></script><script type="text/javascript" src="../_static/js/bootstrap-sphinx.js"></script><script type="text/javascript" src="../_static/js/abixTreeList-2.js"></script><script type="text/javascript" src="../_static/js/cdap-dynamicscrollspy-4.js"></script><script type="text/javascript" src="../_static/js/cdap-version-menu.js"></script><script type="text/javascript" src="../_static/js/copy-to-clipboard.js"></script><script type="text/javascript" src="../_static/js/jquery.mousewheel.min.js"></script><script type="text/javascript" src="../_static/js/jquery.mCustomScrollbar.js"></script><script type="text/javascript" src="../_static/js/js.cookie.js"></script><script type="text/javascript" src="../_static/js/tabbed-parsed-literal-0.2.js"></script><script type="text/javascript" src="../_static/js/cdap-onload-javascript.js"></script><script type="text/javascript" src="../_static/js/cdap-version-menu.js"></script>
    <script src="https://cdap.gitee.io/docs/cdap/json-versions.js"/></script>
  </body>
</html>